#include <errno.h>
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>

#include "Server.h"
#include "DBConnection.h"
#include "../Komunikacja/Connector.h"

int main(int argc, char *argv[]) {
//	Connector * connector = Connector::GetInstance();
	printf("Welcome to Server\n");
	
	//test database
	printf("Connecting to database DBKlewki.db...\n");
	DBConnection * db = DBConnection::GetInstance();
	db->checkConnection();
	db->clearDB();
	db->initializeDB();
	db->printDB();
	
	//run server
	printf("Activating Server...\n");
	Server * serv = new Server();
	if(serv->run()){
		printf("Error occured closing server. All information should be safe.");
	}
	
	//clear after yourself :]
	delete serv;
	delete db;
	
	return EXIT_SUCCESS;
}
